'use strict'

define(['jquery', 'bootstrap', 'select2', 'shiftform', 'validate', 'validate.en', 
        'datetimepicker', 'datetimepickerCN'], function ($) {
  return {
  
    init: function () {
      this.initPage();
    },
  
    initPage: function () {
      
	    $('select[name="trailerType"]').select2({
	      theme: "classic",
	      placeholder: '请选择挂车类型',
	      minimumResultsForSearch: -1,
	      allowClear: true
	    });
	    
	    $('select[name="vehicleType"]').select2({
        theme: "classic",
        placeholder: '请选择挂车类型',
        minimumResultsForSearch: -1,
        allowClear: true
      });

	    $('.date').datetimepicker({
	      format: 'yyyy-mm-dd',
	      autoclose: true,
	      language: 'zh-CN',
	      todayBtn: 'linked',
	      startDate: '${today}',
	      todayHighlight: true,
	      pickerPosition: 'bottom-right',
	      minView: 'month'
	    });
    	
	    $('.month').datetimepicker({  
	      format: 'yyyy-mm',
	      autoclose: true,  
	      weekStart: 1,  
	      startView: 3,  
	      minView: 3,  
	      forceParse: false,  
	      language: 'zh-CN'  
	    });
	    
	    $('form[data-validate="true"]').bt_validate()  //bind validate
	  
    }

  }
})